/**
 * Copyright (c) 2016-2019 九点科技 All rights reserved.
 *
 * http://www.9dyun.cn
 *
 * 版权所有，侵权必究！
 */
package com.dian.modules.sale.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dian.common.utils.MapUtils;
import com.dian.modules.sale.dao.DeliverLineDao;
import com.dian.modules.sale.entity.DeliverHeadEntity;
import com.dian.modules.sale.entity.DeliverLineEntity;
import com.dian.modules.sale.service.DeliverLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 销售发货单明细服务实现类
 *
 * @author xiaolai
 * @email xiaolai@9dyun.cn
 * @date 2019-06-21 16:00:09
 */
@Service("DeliverLineService")
public class DeliverLineServiceImpl extends ServiceImpl<DeliverLineDao, DeliverLineEntity> implements DeliverLineService {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    public DeliverLineService deliverLineService;

    @Override
    public boolean updateInfo(DeliverHeadEntity deliverHeadEntity) {
        List<DeliverLineEntity> lineList=deliverHeadEntity.getDeliverLineEntityList();
        this.removeByMap(new MapUtils().put("deliver_id", deliverHeadEntity.getId()));
        this.saveBatch(lineList);
        return true;

    }

    @Override
    public boolean deleteInfo(Long id) {
        return this.remove(new QueryWrapper<DeliverLineEntity>().eq("deliver_id",id));

    }

    @Override
    public List<DeliverLineEntity> queryLineList(Long id) {
        return this.list(new QueryWrapper<DeliverLineEntity>().eq("deliver_id",id));

    }

}
